package com.MartynovichIgor.KnowledgeTest.questions;

/**
 * Класс Question создает обьект
 * с полями question и answer.
 */
public class Question {
    private int questionId;
    private String question;
    private String condition;
    private String answer;


    public Question(String question, String condition, String answer, int questionId) {
        this.question = question;
        this.condition = condition;
        this.answer = answer;
        this.questionId = questionId;

    }

    public void printQuestion() {
        System.out.println(question);
    }

    public void printCondition() {
        System.out.println(condition);
    }

    /**
     * Метод возвращает количество балов за ответ пользователя.
     * @param userAnswers
     * @return количествоо балов за ответ.
     */
    public int getUserPointForQuestion(String userAnswers) {
        int localScore = 0;
        if (userAnswers == null) {
            return 0;
        }
        if (userAnswers.equals(answer))
            localScore = 1;
        return localScore;
    }

    public String getAnswer() {
        return answer;
    }

    public int getQuestionId() {
        return questionId;
    }

    public String getCondition() {
        return condition;
    }
}
